<?php
/**
 * SystemLogService
 * 
 * @package Akimimi front
 * @author by fsq
 */

require_once ('../app/core/services/BaseService.php');
require_once '../app/models/LogDao.php';
class SystemLogService extends BaseService {
	
    private $logDao;
    
    public function __construct(){
        parent::__construct();
        $this->logDao = new LogDao($this->dbUtil);
    }
    
    public function insertSystemLog($action,$userId,$actionType=2,$actionResult=array(),$actionCondition = array()){
        $log=array();
        $log['action']=$action;
        $result = array();
        if(!empty($actionResult)){
            $result['data'] = $actionResult;
        }    
        if(!empty($actionCondition)){
            $result['condition'] = $actionCondition;
        }        
        $log['action_result']=json_encode($result);
        $log['user_id']=$userId;
        $log['action_type']=$actionType;
        $logId = $this->logDao->insertLog($log);
    }    
}